Conversation
c2673c5 to
2a5a5d5
Compare
| fun getShareFromNote( | ||
| @Query("path") path: String, | ||
| @Query("shared_with_me") sharedWithMe: Boolean = true | ||
| @Query("shared_with_me") sharedWithMe: Boolean = false |
There was a problem hiding this comment.
The web calls
format=json
path=%2FNotes%2FSamples%2FFormatting.md
shared_with_me=true
So I am not sure if this is correct to be changed
|
|
||
| if (share.getSharedWithDisplayName() != null) { | ||
| AvatarLoader.INSTANCE.load(context, binding.icon, account, share.getSharedWithDisplayName()); | ||
| AvatarLoader.INSTANCE.load(context, binding.icon, account, share.getShareWith()); |
There was a problem hiding this comment.
Than the if-clause needs to be updated as well
| note.title + | ||
| notesSuffix | ||
| } | ||
| return StringConstants.PATH + notesPath + StringConstants.PATH + note.category + StringConstants.PATH + note.title + notesSuffix |
There was a problem hiding this comment.
this will fail for notes not in a category I guess because it woudl add a StringConstants.PATH + StringConstants.PATH no?
|
What issue or bug does this PR fix? What should we test, and how should we test it? Could you share steps to reproduce the issue? |
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
2a5a5d5 to
c6ebd51
Compare
| fun getShareFromNote( | ||
| @Query("path") path: String, | ||
| @Query("shared_with_me") sharedWithMe: Boolean = true | ||
| @Query("shared_with_me") sharedWithMe: Boolean = false |
There was a problem hiding this comment.
By default is true in current master but expected value is false then? And in where exactly this didn't set to actual value.
|
|
||
| if (share.getSharedWithDisplayName() != null) { | ||
| AvatarLoader.INSTANCE.load(context, binding.icon, account, share.getSharedWithDisplayName()); | ||
| AvatarLoader.INSTANCE.load(context, binding.icon, account, share.getShareWith()); |
| } | ||
|
|
||
| fun getShareFromNote(note: Note): List<OCShare>? { | ||
| fun getShareFromNote(note: Note): List<OCShare> { |
There was a problem hiding this comment.
No need mutable list conversion and we can clearify variable names. Could you please change with following code?
fun getShareFromNote(note: Note): List<OCShare> {
val sharesWithMe = fetchShares(note, sharedWithMe = true)
val sharesWithOthers = fetchShares(note, sharedWithMe = false)
return sharesWithOthers + sharesWithMe
}
private fun fetchShares(note: Note, sharedWithMe: Boolean): List<OCShare> {
val api = apiProvider.getShareAPI(applicationContext, account)
val path = getNotePath(note) ?: return emptyList()
val call = api.getShareFromNote(path, sharedWithMe)
val response = call.execute()
return try {
if (response.isSuccessful) {
val body = response.body()
Log_OC.d(tag, "Response successful: $body")
body?.ocs?.data?.toOCShareList() ?: emptyList()
} else {
val errorBody = response.errorBody()?.string()
Log_OC.d(tag, "Response failed: $errorBody")
emptyList()
}
} catch (e: Exception) {
Log_OC.d(tag, "Exception while getting share from note: ", e)
emptyList()
}
}|
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/2974.apk |


No description provided.